Path 1: 319 calls (0.98)

1 (74) 2 (27) 'foo' (26) 0 (15) None (14) 'Hello World' (11) 'bar' (10) 3 (9) False (7) True (7)

'1' (74) '2' (27) "'foo'" (26) '0' (15) 'None' (14) "'Hello World'" (11) "'bar'" (10) '3' (9) 'False' (7) 'True' (7)

1def to_repr(obj: Any) -> str:
2        """Get repr string for an object, but catch errors."""
3        if (
4            max_string is not None
5            and _safe_isinstance(obj, (bytes, str))
6            and len(obj) > max_string
7        ):
8            truncated = len(obj) - max_string
9            obj_repr = f"{obj[:max_string]!r}+{truncated}"
10        else:
11            try:
12                obj_repr = repr(obj)
13            except Exception as error:
14                obj_repr = f"<repr-error {str(error)!r}>"
15        return obj_repr
            

Path 2: 5 calls (0.02)

1 (2) test_inspect_swig_edge_case..Thing (2) Console (1)

'1' (2) '.Thing object at 0x2ac70b880>' (2) '' (1)

1def to_repr(obj: Any) -> str:
2        """Get repr string for an object, but catch errors."""
3        if (
4            max_string is not None
5            and _safe_isinstance(obj, (bytes, str))
6            and len(obj) > max_string
7        ):
8            truncated = len(obj) - max_string
9            obj_repr = f"{obj[:max_string]!r}+{truncated}"
10        else:
11            try:
12                obj_repr = repr(obj)
13            except Exception as error:
14                obj_repr = f"<repr-error {str(error)!r}>"
15        return obj_repr
            

Path 3: 1 calls (0.0)

test_broken_repr..BrokenRepr (1)

"" (1)

ZeroDivisionError (1)

1def to_repr(obj: Any) -> str:
2        """Get repr string for an object, but catch errors."""
3        if (
4            max_string is not None
5            and _safe_isinstance(obj, (bytes, str))
6            and len(obj) > max_string
7        ):
8            truncated = len(obj) - max_string
9            obj_repr = f"{obj[:max_string]!r}+{truncated}"
10        else:
11            try:
12                obj_repr = repr(obj)
13            except Exception as error:
14                obj_repr = f"<repr-error {str(error)!r}>"
15        return obj_repr
            

Path 4: 1 calls (0.0)

'HelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHello' (1)

"'HelloHel'+92" (1)

1def to_repr(obj: Any) -> str:
2        """Get repr string for an object, but catch errors."""
3        if (
4            max_string is not None
5            and _safe_isinstance(obj, (bytes, str))
6            and len(obj) > max_string
7        ):
8            truncated = len(obj) - max_string
9            obj_repr = f"{obj[:max_string]!r}+{truncated}"
10        else:
11            try:
12                obj_repr = repr(obj)
13            except Exception as error:
14                obj_repr = f"<repr-error {str(error)!r}>"
15        return obj_repr